<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>如果一个类没有构造方法，它默认有无参的构造方法。</li>
    </ul>
    <script>
        class Student {

            name;

            age;

            setName(name) {
                this.name = name;
            }

            setAge(age) {
                this.age = age;
            }

            getName() {
                return this.name;;
            }

            getAge() {
                return this.age;
            }
        }

        let stu = new Student();

        stu.setName("奉先");
        stu.setAge(35);
        console.log(stu.getName(),":",stu.getAge());

    </script>
</body>
</html>